package cn.school.controller.hotel;

import cn.school.common.api.CommonPage;
import cn.school.common.api.CommonResult;
import cn.school.hotel.entity.TripHotelOrder;
import cn.school.hotel.service.TripHotelOrderService;
import cn.school.hotel.vo.ItripHotelOrderVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hotel/hotelOrder")
public class TripHotelOrderController {

    @Autowired
    private TripHotelOrderService tripHotelOrderService;

    @ApiOperation("list => 分页查询酒店列订单表")
    @GetMapping(value = "/getHotelOrderPagelist")
    public CommonResult<CommonPage<TripHotelOrder>> getHotelOrderPagelist(TripHotelOrder tripHotelOrder,
                                                                          @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                                          @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        IPage<TripHotelOrder> page = tripHotelOrderService.getHotelOrderPagelist(tripHotelOrder,pageSize,pageNum);
        return CommonResult.success(CommonPage.restPage(page));
    }

    @ApiOperation("list => 查询酒店列订单详情")
    @GetMapping(value = "/getHotelOrderDetail")
    public CommonResult<ItripHotelOrderVO> getHotelOrderDetail(@RequestParam("id") String id) {
        ItripHotelOrderVO orderInfo = tripHotelOrderService.getHotelOrderDetail(id);
        return CommonResult.success(orderInfo);
    }



}
